package com.oo.array_$.case_1;

import java.util.Scanner;

/**
 * Search--某班级有 10 个学员，学员姓名存储在数组中，
 * 现在在数组中查找此班级，是否有用户输入的学员姓名，
 * 如果找到了，输出“该学员在此班”，否则输出“没 有找到”
 *
 * @author: Jovi
 * @createTime: 2017-05-11 13:49
 **/
public class Search {
    public static void main(String[] args) {
        String[] names = new String[10];
        int i ;
        Scanner sc = new Scanner(System.in);
        System.out.println("Please enter students name：");
        for (i = 0; i < names.length; i++) {
            names[i] = sc.nextLine();
        }
        System.out.println("Please enter the name of the need to look up：");
        String search = sc.nextLine();
        for (i = 0;i< names.length;i++) {
            if (names[i].equals(search)) {
                break;
            }
        }
        if (i < 10) {
            System.out.println("The student is in this class");
        } else {
            System.out.println("The student is not in this class");
        }
    }
}
